package client.presentation;

import javax.media.j3d.Group;
import javax.media.j3d.TransformGroup;

import org.jdesktop.j3d.loaders.vrml97.VrmlLoader;

import client.controller.Object3DController;

import com.sun.j3d.loaders.Scene;

//Classe mettant en oeuvre la representation 3D d'un objet
public class Object3DPresentation extends TransformGroup {

	protected Object3DController controller;

	public Object3DPresentation(Object3DController controller, String vrml) {
		super();
		this.controller = controller;

		VrmlLoader loader = new VrmlLoader();
		Scene loadedScene;
		
		try {
			loadedScene = loader.load(vrml);
			this.addChild (loadedScene.getSceneGroup ()) ;
			this.setCapability (TransformGroup.ALLOW_TRANSFORM_WRITE) ;
			this.setCapability (TransformGroup.ALLOW_TRANSFORM_READ) ;
			this.setCapability (Group.ALLOW_CHILDREN_READ);
			this.setCapability (Group.ALLOW_CHILDREN_WRITE);
			this.setCapability (TransformGroup.ENABLE_PICK_REPORTING) ;

		} 
		catch (Exception e) {
			e.printStackTrace();
		}
	}

	public Object3DController getController() {
		return controller;
	}
}


